<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/layui/css/layui.css">
    <script src="/layui/layui.js"></script>
    <script src="/js/jquery-3.3.1.min.js"></script>

    <script src="/ueditor/third-party/jquery-1.10.2.js"></script>
    <!-- 配置文件 -->
    <script src="/ueditor/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script src="/ueditor/ueditor.all.js"></script>
    <script src="/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script src="/ueditor/ueditor.parse.js"></script>

</head>
<body>
<ul class="layui-nav layui-nav-tree layui-nav-side" lay-filter="demo">
    <li class="layui-nav-item">
        <a href="/index">发帖</a>
    </li>
    <li class="layui-nav-item">
        <a href="/detail">查看帖子</a>
    </li>
    <li class="layui-nav-item"><a href="/ueditor">UEditor</a></li>
</ul>
<div class="layui-row layui-form" id="list" style="margin-left: 250px;margin-top: 40px">

</div>
<script type="application/javascript">

    layui.use('form', function () {
        var $ = layui.jquery;

        //ajax提交信息
        $.ajax({
            type: "get",
            async: false,
            url: "/forum/get_all_forum",
            dataType: 'json',
            success: function (msg) {
                console.log(msg);
                let list = document.getElementById("list");
                let html = '';
                for (let i = 0; i < msg.data.length; i++) {
                    html += '<blockquote class="layui-elem-quote"><a href="/forum?id='+msg.data[i].f_id+'">' + (i+1) + "、" + msg.data[i].title+'</a></blockquote>';
                }
                list.innerHTML = html;
            },
            error: function (msg) {
                // 请求失败时执行该函数
                layer.alert('请求数据失败！！！', function (index) {
                    //do something
                    layer.close(index);
                });
            }
        });

        return false;
    });
</script>

</body>
</html>